# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Karol Babioch <karol@babioch.de>

pkgname=python-pysnmp
_pyname=pysnmp
pkgver=4.4.12
pkgrel=7
pkgdesc='Open source and free implementation of v1/v2c/v3 SNMP engine'
url='https://github.com/etingof/pysnmp'
arch=('any')
license=('BSD')
depends=('python' 'python-pysmi' 'python-pyasn1' 'python-pycryptodomex')
makedepends=('python-setuptools' 'python-sphinx')
options=('!makeflags')
source=(https://github.com/etingof/pysnmp/archive/v${pkgver}/${_pyname}-v${pkgver}.tar.gz)
sha256sums=('137d8fd93fffadd0c6d34c65e4dda373f41122a5f1c38537cc9ec4194dc99980')
sha512sums=('48481e219098369b09cc2ffea6cd51974b64bed0131671cc7a2213ee5eb432c62e0ff5c3700b6be515bd3e90951927e41845c98ae7a339d551f0f4ec19c5e3b1')

build() {
  cd ${_pyname}-${pkgver}
  export PYTHONPATH=.
  python setup.py build
  make -C docs text man
}

package() {
  cd ${_pyname}-${pkgver}
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r docs/build/text "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r examples -t "${pkgdir}/usr/share/doc/${pkgname}"

  install -Dm 644 docs/build/man/${_pyname}.1 "${pkgdir}/usr/share/man/man1/${_pyname}.1"
  install -Dm 644 docs/build/man/${_pyname}.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"
  install -Dm 644 LICENSE.rst -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
